package cn.wolfcode.crm.serivce.impl;

import cn.wolfcode.crm.domain.Robot;
import cn.wolfcode.crm.mapper.RobotMapper;
import cn.wolfcode.crm.serivce.IRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class RobotImpl implements IRobotService {
    @Autowired
    private RobotMapper mapper;

    @Override
    public void deleteByPrimaryKey(Long id) {
        mapper.deleteByPrimaryKey(id);
    }

    @Override
    public void saveOrUpdate(Robot record) {
        if (record.getId() == null) {
            //保存操作
            mapper.insert(record);
        }else {
            mapper.updateByPrimaryKey(record);
        }
    }

    @Override
    public Robot selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Robot> selectAll() {
        return mapper.selectAll();
    }

    @Override
    public Robot selectByRequest(String keyword) {
       return  mapper.selectByRequest(keyword);
    }

}
